﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
using TaoPortal.BusinessLogic.Repository;

namespace TaoPortal.Controllers
{
    public class WebApiController : Controller
    {
        public ActionResult GetProvince()
        {
            var rp = new UserRepository();
            return Json(rp.GetProvince());
        }

        public ActionResult GetZoneByParentID(string id)
        {
            var rp = new UserRepository();
            var data = rp.GetZoneByParentID(id);
            JsonResult res = new JsonResult();
            res.Data = data.Select(x => new { text = x.ZoneName, value = x.ID }).ToList();
            res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return res;
        }

    }
}
